<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>THROW</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="internals2.opcodes.switch-free.html">SWITCH_FREE</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="internals2.opcodes.ticks.html">TICKS</a></div>
 <div class="up"><a href="internals2.opcodes.list.html">Opcode Descriptions and Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="internals2.opcodes.throw" class="section">
 <h2 class="title">THROW</h2>
 <div class="section" id="internals2.opcodes.throw.code">
  <h2 class="title">PHP code</h2>
  <div class="example-contents">
   <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*<br />&nbsp;*&nbsp;<br />&nbsp;*&nbsp;opcode&nbsp;number:&nbsp;108<br />&nbsp;*/<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$error&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Always&nbsp;throw&nbsp;this&nbsp;error'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">Exception</span><span style="color: #007700">(</span><span style="color: #0000BB">$error</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Code&nbsp;following&nbsp;an&nbsp;exception&nbsp;is&nbsp;not&nbsp;executed.<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'Never&nbsp;executed'</span><span style="color: #007700">;<br /><br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">Exception&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Caught&nbsp;exception:&nbsp;'</span><span style="color: #007700">,&nbsp;&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">(),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Continue&nbsp;execution<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'Hello&nbsp;World'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
  </div>

 </div>
 <div class="section" id="internals2.opcodes.throw.listing">
  <h2 class="title">PHP opcodes</h2>
  <p class="simpara">Function name: (null)</p>
  <p class="simpara">Compiled variables: !0=$error,  !1=$e </p>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>line</th><th>#</th><th>op</th>
      <th>fetch</th><th>ext</th><th>return</th>
      <th>operands</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7</td><td>0</td>
      <td>ASSIGN</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>!0,&#039;Always+throw+this+error&#039;</td>
     </tr>

     <tr>
      <td>8</td><td>1</td>
      <td>ZEND_FETCH_CLASS</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td>:1</td>
      <td>&#039;Exception&#039;</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>2</td>
      <td>NEW</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td>$2</td>
      <td>:1</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>3</td>
      <td>SEND_VAR</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>!0</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>4</td>
      <td>DO_FCALL_BY_NAME</td><td class="empty">&nbsp;</td>
      <td>1</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>5</td>
      <td>ZEND_THROW</td><td class="empty">&nbsp;</td>
      <td>0</td><td class="empty">&nbsp;</td>
      <td>$2</td>
     </tr>

     <tr>
      <td>11</td><td>6</td>
      <td>ECHO</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>&#039;Never+executed&#039;</td>
     </tr>

     <tr>
      <td>13</td><td>7</td>
      <td>JMP</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>-&gt;15</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>8</td>
      <td>ZEND_FETCH_CLASS</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td>:4</td>
      <td>&#039;Exception&#039;</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>9</td>
      <td>ZEND_CATCH</td><td class="empty">&nbsp;</td>
      <td>15</td><td class="empty">&nbsp;</td>
      <td>$4,!1</td>
     </tr>

     <tr>
      <td>14</td><td>10</td>
      <td>ECHO</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>&#039;Caught+exception%3A+&#039;</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>11</td>
      <td>ZEND_INIT_METHOD_CALL</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>!1,&#039;getMessage&#039;</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>12</td>
      <td>DO_FCALL_BY_NAME</td><td class="empty">&nbsp;</td>
      <td>0</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>13</td>
      <td>ECHO</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>$6</td>
     </tr>

     <tr>
      <td class="empty">&nbsp;</td><td>14</td>
      <td>ECHO</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>&#039;%0A&#039;</td>
     </tr>

     <tr>
      <td>18</td><td>15</td>
      <td>ECHO</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>&#039;Hello+World&#039;</td>
     </tr>

     <tr>
      <td>19</td><td>16</td>
      <td>RETURN</td><td class="empty">&nbsp;</td>
      <td class="empty">&nbsp;</td><td class="empty">&nbsp;</td>
      <td>1</td>
     </tr>

    </tbody>
   
  </table>

 </div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="internals2.opcodes.switch-free.html">SWITCH_FREE</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="internals2.opcodes.ticks.html">TICKS</a></div>
 <div class="up"><a href="internals2.opcodes.list.html">Opcode Descriptions and Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
